package io;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.util.Scanner;

public class Test_2 {
    public static void main(String[] args) throws IOException {
        FileOutputStream fos = new FileOutputStream("note_2.txt");
        OutputStreamWriter osw = new OutputStreamWriter(fos);
        Scanner scanner = new Scanner(System.in);
        System.out.println("开始输入内容，单独输入exit时退出");
        while (true){
            String suns = scanner.nextLine();
            if ("exit".equalsIgnoreCase(suns)){
                break;
            }
            osw.write(suns);
            System.out.println("输入成功");

        }
        osw.close();

    }
}
